<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>My JSP 'edit_sys_user_info.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="${ctx }/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctx }/css/font-awesome.css?v=4.4.0" rel="stylesheet">

<!-- jqgrid-->
<link href="${ctx }/css/plugins/jqgrid/ui.jqgrid.css?0820"
	rel="stylesheet">

<link href="${ctx }/css/animate.css" rel="stylesheet">
<link href="${ctx }/css/style.css?v=4.1.0" rel="stylesheet">
<link
	href="${ctx}/css/plugins/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet" />
<!-- bootstrap-switch css -->
<link href="${ctx }/css/plugins/bootstrap-switch/bootstrap-switch.css"
	rel="stylesheet">
<style type="text/css">
body {
	background: none;
}

.row-right {
	padding-left: 0;
}

.row-left {
	padding-right: 0;
}

.control-label {
	padding-right: 0;
}

.input-left {
	padding-right: 0;
}

.input-right {
	padding-left: 0;
}

@media ( min-width : 850px) {
	.modal-dialog {
		width: 848px;
	}
}
</style>
</head>
<body>

	<div class="inmodal" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content animated bounceInRight">
				<div class="modal-header">
					<button type="button" class="close closeWin" data-dismiss="modal">
						<span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
					</button>
					<h5 class="modal-title">编辑数据项配置</h5>
				</div>
				<div class="ibox-content">
					<form class="form-horizontal m-t" name="editDictFrom"
						id="editDictFrom">
						<input type="hidden" id="id" name="id" value="${itemModel.id}" />
						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">数据项名称：</label>
									<div class="col-sm-8 input-left">
										<input id="item_name" name="item_name" class="form-control"
											required="" aria-required="true" type="text"
											value="${itemModel.item_name}">
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">管理部门：</label>
									<div class="col-sm-8 input-right">
										<select id="org_id" name="org_id" class="form-control"
											required="" aria-required="true">
											<option value="${itemModel.org_id}">${itemModel.org_name}</option>
											<c:forEach items="${orglist}" var="orgInfo">
												<option value="${orgInfo.org_id}">${orgInfo.org_name}</option>
											</c:forEach>
										</select>
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">起始系统：</label>
									<div class="col-sm-8 input-left">
										<select class="selectpicker" aria-required="true"
											name="initial_system" id="initial_system">
											<option value="">--请选择--</option>
											<c:forEach items="${dictlist}" var="dictInfo">
												<option value="${dictInfo.dictname}"
													<c:if test="${dictInfo.dictname eq itemModel.initial_system}">selected</c:if>>${dictInfo.dictname}</option>
											</c:forEach>
										</select>
									</div>


								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">目标系统：</label>
									<div class="col-sm-8 input-right">
										<select class="selectpicker" aria-required="true"
											name="target_system" id="target_system">
											<option value="">--请选择--</option>
											<c:forEach items="${dictlist}" var="dictInfo">
												<option value="${dictInfo.dictname}"
													<c:if test="${dictInfo.dictname eq itemModel.target_system}">selected</c:if>>${dictInfo.dictname}</option>
											</c:forEach>
										</select>
									</div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">起始用户：</label>
									<div class="col-sm-8 input-left">
										<input id="initial_user" name="initial_user"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.initial_user}">
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">目标用户：</label>
									<div class="col-sm-8 input-right">
										<input id="target_user" name="target_user"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.target_user}">
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">起始表名称：</label>
									<div class="col-sm-8 input-left">
										<input id="initial_table_name" name="initial_table_name"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.initial_table_name }">
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">目标表名称：</label>
									<div class="col-sm-8 input-right">
										<input id="target_table_name" name="target_table_name"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.target_table_name }">
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">起始主键：</label>
									<div class="col-sm-8 input-left">
										<input id="initial_primary_key" name="initial_primary_key"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.initial_primary_key }">
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">目标主键：</label>
									<div class="col-sm-8 input-right">
										<input id="target_primary_key" name="target_primary_key"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.target_primary_key}">
									</div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">增量监控sql：</label>
									<div class="col-sm-8 input-left">
										<textarea id="sql_increment_monitor" rows="3" cols="50" name="sql_increment_monitor"
											class="form-control"  aria-required="true"
											>${itemModel.sql_increment_monitor}</textarea>
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">全量标识sql：</label>
									<div class="col-sm-8 input-right">
										<textarea id="sql_total_identifier" rows= "3"  cols="50" name="sql_total_identifier"
											class="form-control"  aria-required="true"
											 >${itemModel.sql_total_identifier }</textarea>
									</div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">增量标识：</label>
									<div class="col-sm-8 input-left">
										<input id="increment_identifier" name="increment_identifier"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.increment_identifier }">
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">全量标识：</label>
									<div class="col-sm-8 input-right">
										<input id="total_identifier" name="total_identifier"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.total_identifier }">
									</div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">增量标识监控sql：</label>
									<div class="col-sm-8 input-left">
										<textarea id="sql_incre_identifer_monitor"
											name="sql_incre_identifer_monitor" rows="3" cols="50" class="form-control"
											 aria-required="true"
											>${itemModel.sql_incre_identifer_monitor}</textarea>
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">全量标识监控sql：</label>
									<div class="col-sm-8 input-right">
										<textarea id="sql_total_identifier_monitor"
											name="sql_total_identifier_monitor" rows="3" cols="50" class="form-control"
											 aria-required="true"
											>${itemModel.sql_total_identifier_monitor }</textarea>
									</div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">增量当前值：</label>
									<div class="col-sm-8 input-left">
										<input id="increment_value" name="increment_value"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.increment_value }">
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">全量当前值：</label>
									<div class="col-sm-8 input-right">
										<input id="total_value" name="total_value"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.total_value }">
									</div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">起始连接方式：</label>
									<div class="col-sm-8 input-left">
										<input id="initial_link" name="initial_link"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.initial_link }">
									</div>
								</div>
								<div class="col-sm-6 row-right">
									<label class="col-sm-4 control-label">目标连接方式：</label>
									<div class="col-sm-8 input-right">
										<input id="target_link" name="target_link"
											class="form-control"  aria-required="true"
											type="text" value="${itemModel.target_link }">
									</div>
								</div>
							</div>
						</div>
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">起始系统时间字段：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="initial_timekey" name="initial_timekey" class="form-control"
                                   type="text" value="${itemModel.initial_timekey }">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">目标系统时间字段：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="target_timekey" name="target_timekey" class="form-control"
                                     type="text" value="${itemModel.target_timekey}">
                                </div>
                             </div>
                          </div>
                       </div>
						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">一致性监控状态：</label>
									<div class="col-sm-2">
										<div class="switch has-switch">
											<div id="share_switch_div_consistency"
												class="switch-on switch-animate">
												<input id="consistency_flag_input" type="checkbox"
													checked="checked">
											</div>
										</div>
										<input id="consistency_flag" name="consistency_flag"
											type="hidden" value="${itemModel.consistency_flag }">
									</div>
								</div>

								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">完整性监控状态：</label>
									<div class="col-sm-2">
										<div class="switch has-switch">
											<div id="share_switch_div_integrity"
												class="switch-on switch-animate">
												<input id="integrity_flag_input" type="checkbox"
													checked="checked">
											</div>
										</div>
										<input id="integrity_flag" name="integrity_flag" type="hidden"
											value="${itemModel.integrity_flag }">
									</div>
								</div>
							</div>
						</div>

						<div class="form-group">
							<div class="row">
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">准确性监控状态：</label>
									<div class="col-sm-2">
										<div class="switch has-switch">
											<div id="share_switch_div_accuracy"
												class="switch-on switch-animate">
												<input id="accuracy_flag_input" type="checkbox"
													checked='<c:if test="${itemModel. accuracy_flag == 1}">checked</c:if>'>
											</div>
										</div>
										<input id="accuracy_flag" name="accuracy_flag" type="hidden"
											value="${itemModel.accuracy_flag }">
									</div>
								</div>
								<div class="col-sm-6 row-left">
									<label class="col-sm-4 control-label">运行状态：</label>
									<div class="col-sm-2">
										<div class="switch has-switch">
											<div id="switch_run_div" class="switch-on switch-animate">
												<input id="switch_run_input" type="checkbox"
													checked="checked">
											</div>
										</div>
										<input id="switch_run" name="switch_run" type="hidden" value="${itemModel.switch_run }">
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-4">
								<button type="button" class="btn btn-white closeWin"
									data-dismiss="modal">关闭</button>
								<button type="submit" class="btn btn-primary">保存</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- 全局js -->
	<script src="${ctx }/js/jquery.min.js?v=2.1.4"></script>
	<script src="${ctx }/js/bootstrap.min.js?v=3.3.6"></script>

	<!-- Peity -->
	<script src="${ctx }/js/plugins/peity/jquery.peity.min.js"></script>

	<!-- jqGrid -->
	<script src="${ctx }/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
	<script src="${ctx }/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

	<!-- jQuery Validation plugin javascript-->
	<script src="${ctx }/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="${ctx }/js/plugins/validate/messages_zh.min.js"></script>

	<!-- layer javascript -->
	<script src="${ctx }/js/plugins/layer/layer.min.js"></script>

	<!-- jQuery form-->
	<script src="${ctx }/js/jquery.form.js"></script>

	<!-- 自定义js ---->
	<script src="${ctx }/js/content.js?v=1.0.0"></script>
	<script src="${ctx }/js/plugins/layer/laydate/laydate.js"></script>
	<script
		src="${ctx}/js/plugins/bootstrap-select/bootstrap-select.min.js"></script>
	<!-- bootstrap-switch js -->
	<script src="${ctx }/js/plugins/bootstrap-switch/bootstrap-switch.js"></script>
	<script type="text/javascript">
		//绑定修改表单提交事件,异步提交表单
		$('.closeWin').click(function() {
			window.parent.editWinClose('1');
		});
		$("#editDictFrom").submit(function() {
			$.ajax({
				type : "post",
				url : "${ctx }/monit_item/do_edit_dict_item",
				data : $('#editDictFrom').serialize(),
				datatype : "json",
				success : function(data) {
					if (data.errcode == '0') {
						layer.alert(data.errmsg, {
							icon : 1
						}, function(index) {

							window.parent.editWinClose('0');
							//关闭提示框
						});
					} else {
						layer.alert("保存失败！", {
							icon : 2
						});
					}
				}
			});

			return false;
		});

		var v_accuracy_flag = "${itemModel.accuracy_flag}";
		var v_switch;
		if (v_accuracy_flag == 1) {
			v_switch = true;
		} else {
			v_switch = false;
		}

		//准确性监控开关
		$('#share_switch_div_accuracy input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : v_switch,
			onInit : function(event, state) {//初始化开关
				$("#accuracy_flag").val(v_accuracy_flag);
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#accuracy_flag").val("1");
				} else {
					$("#accuracy_flag").val("0");
				}
			}
		});

		var v_accuracy_flag = "${itemModel.consistency_flag}";
		var v_switch;
		if (v_accuracy_flag == 1) {
			v_switch = true;
		} else {
			v_switch = false;
		}

		//一致性监控开关
		$('#share_switch_div_consistency input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : v_switch,
			onInit : function(event, state) {//初始化开关
				$("#consistency_flag").val(v_accuracy_flag);
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#consistency_flag").val("1");
				} else {
					$("#consistency_flag").val("0");
				}
			}
		});

		var v_accuracy_flag = "${itemModel.integrity_flag}";
		var v_switch;
		if (v_accuracy_flag == 1) {
			v_switch = true;
		} else {
			v_switch = false;
		}
		//完整性监控开关
		$('#share_switch_div_integrity input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : v_switch,
			onInit : function(event, state) {//初始化开关
				$("#integrity_flag").val(v_accuracy_flag);
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#integrity_flag").val("1");
				} else {
					$("#integrity_flag").val("0");
				}
			}
		});
		//运行状态开关
		var v_switch_run = "${itemModel.switch_run}";
		var v_switch;
		if (v_switch_run == 1) {
			v_switch = true;
		} else {
			v_switch = false;
		}
		$('#switch_run_div input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : v_switch,
			onInit : function(event, state) {//初始化开关
				$("#switch_run").val(v_switch_run);
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#switch_run").val("1");
				} else {
					$("#switch_run").val("0");
				}
			}
		});
	</script>
</body>
</html>
